﻿using Model.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIE.SCADA.ZemtDemo.ViewModel
{
    public abstract  class QueryBaseViewModel<T> : NotifyPropertyChanged, IQuery
    {
        public QueryBaseViewModel()
        {
            //Query();
        }

        public virtual void Add()
        {
            Query();
        }

        public virtual void Delete()
        {
            Query();
        }

        public virtual void Query()
        {
            
        }

        public virtual void Update()
        {
            Query();
        }

        private List<T> _Records;
        public List<T> Records
        {
            get { return _Records; }
            set
            {
                if (value != _Records)
                {
                    _Records = value;
                    OnPropertyChanged(nameof(Records));
                }
            }
        }

        public T CurItem { get; set; }
    }
}
